﻿namespace Sidvall.WorkItemManager.UI
{
	public partial class SystemContextConfig
	{
		#region Public Members

		public global::Sidvall.WorkItemManager.UI.Entities.ConfigModel.EntityCache EntityCache { get; set; }
		public global::Sidvall.WorkItemManager.UI.Entities.ConfigModel.EntityFacade EntityFacade { get; set; }

		#endregion
		#region Factory Members

		static partial void OnCreateSystemContext(SystemContextConfig item);
		private static readonly object _Mutex = new object();
		private static volatile SystemContextConfig _Current;
		public static SystemContextConfig Current
		{
			get
			{
				if (_Current == null)
				{
					lock (_Mutex)
					{
						if (_Current == null)
						{
							var item = new SystemContextConfig()
							{
								EntityCache = new global::Sidvall.WorkItemManager.UI.Entities.ConfigModel.EntityCache(),
								EntityFacade = new global::Sidvall.WorkItemManager.UI.Entities.ConfigModel.EntityFacade(),
							};
							OnCreateSystemContext(item);
							_Current = item;
						}
					}
				}
				return _Current;
			}
			set
			{
				lock (_Mutex)
				{
					_Current = value;
				}
			}
		}

		#endregion
		#region Constructors

		public SystemContextConfig()
		{
		}

		#endregion
	}
}